package	model.code;

import editor.Images;
import model.code.line.LineList;
import model.code.line.MultiLineList;
import model.code.line.NameLine;
import model.symbol.Scope;
import model.symbol.Symbol;
import observer.ObservedList;

import javax.swing.*;
import java.util.ArrayList;

/**
 * This class is for files that are documentation files.
 *
 * @author Neil Dickson
 */
public class Document implements ProjectFile,Symbol {
	private final	long			id;
	private String					filename;
	private NameLine				name;
	private MultiLineList			description;
	private	ObservedList<Rowable>	seeAlso;
	private	ObservedList<Rowable>	authors;

	private	ArrayList<StringBuffer>	content;

	public Document(String name) {
		id = Scope.getUniqueID();
		this.name = new NameLine(name.toCharArray(),this);
		this.description = new MultiLineList(null,CodeFileChunk.LOCATION_NOWHERE);
		seeAlso = new ObservedList<Rowable>();
		authors = new ObservedList<Rowable>();
		content = new ArrayList<StringBuffer>();
	}

	public NameLine getName() {
		return name;
	}
	public LineList getDescription() {
		return description;
	}
	public String toString() {
		return name.toString();
	}

	public void addLine(String line) {
		content.add(new StringBuffer(line));
	}

	public ObservedList<Rowable> getSeeAlso() {
		return seeAlso;
	}

	public ObservedList<Rowable> getAuthors() {
		return authors;
	}

	public long getID() {
		return id;
	}

	public ImageIcon getIcon() {
		return Images.DOCUMENT_ICON;
	}
}
